Completed
Push — master ( 97a159...fc6227 )
by Maxence
29s
created

circles.detailsCircle   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
nc 1
nop 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A 0 3 1
A 0 3 1
1
/*
2
 * Circles - Bring cloud-users closer together.
3
 *
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later. See the COPYING file.
6
 *
7
 * @author Maxence Lange <[email protected]>
8
 * @copyright 2017
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
/** global: OC */
27
/** global: OCA */
28
29
var circles = {
30
31
	createCircle: function (type, name, callback) {
32
33
		var result = {status: -1};
34
		$.ajax({
35
			method: 'PUT',
36
			url: OC.generateUrl('/apps/circles/v1/circles'),
37
			data: {
38
				type: type,
39
				name: name
40
			}
41
		}).done(function (res) {
42
			api.onCallback(callback, res);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
43
		}).fail(function () {
44
			api.onCallback(callback, result);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
45
		});
46
	},
47
48
49
	listCircles: function (type, name, level, callback) {
50
		var result = {status: -1};
51
		$.ajax({
52
			method: 'GET',
53
			url: OC.generateUrl('/apps/circles/v1/circles'),
54
			data: {
55
				type: type,
56
				name: name,
57
				level: level
58
			}
59
		}).done(function (res) {
60
			api.onCallback(callback, res);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
61
		}).fail(function () {
62
			api.onCallback(callback, result);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
63
		});
64
	},
65
66
67
	detailsCircle: function (circleId, callback) {
68
		var result = {status: -1};
69
		$.ajax({
70
			method: 'GET',
71
			url: OC.generateUrl('/apps/circles/v1/circles/' + circleId)
72
		}).done(function (res) {
73
			api.onCallback(callback, res);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
74
		}).fail(function () {
75
			api.onCallback(callback, result);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
76
		});
77
	},
78
79
80
	joinCircle: function (circleId, callback) {
81
		var result = {status: -1};
82
		$.ajax({
83
			method: 'GET',
84
			url: OC.generateUrl('/apps/circles/v1/circles/' + circleId + '/join'),
85
			data: {}
86
		}).done(function (res) {
87
			api.onCallback(callback, res);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
88
		}).fail(function () {
89
			api.onCallback(callback, result);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
90
		});
91
	},
92
93
94
	settingsCircle: function (circleId, settings, callback) {
95
		var result = {status: -1};
96
		$.ajax({
97
			method: 'POST',
98
			url: OC.generateUrl('/apps/circles/v1/circles/' + circleId + '/settings'),
99
			data: {settings: settings}
100
		}).done(function (res) {
101
			api.onCallback(callback, res);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
102
		}).fail(function () {
103
			api.onCallback(callback, result);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
104
		});
105
	},
106
107
108
	leaveCircle: function (circleId, callback) {
109
		var result = {status: -1};
110
		$.ajax({
111
			method: 'GET',
112
			url: OC.generateUrl('/apps/circles/v1/circles/' + circleId + '/leave'),
113
			data: {}
114
		}).done(function (res) {
115
			api.onCallback(callback, res);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
116
		}).fail(function () {
117
			api.onCallback(callback, result);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
118
		});
119
	},
120
121
122
	destroyCircle: function (circleId, callback) {
123
		var result = {status: -1};
124
		$.ajax({
125
			method: 'DELETE',
126
			url: OC.generateUrl('/apps/circles/v1/circles/' + circleId),
127
			data: {}
128
		}).done(function (res) {
129
			api.onCallback(callback, res);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
130
		}).fail(function () {
131
			api.onCallback(callback, result);
0 ignored issues
show
Bug introduced by
The variable api seems to be never declared. If this is a global, consider adding a /** global: api */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
132
		});
133
	}
134
135
};
136
137